﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mr="http://mishrareader.codeplex.com/Reader">

    <Style TargetType="{x:Type mr:BusyIndicator}">

        <Setter Property="Background" Value="{x:Null}" />
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="IsHitTestVisible" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type mr:BusyIndicator}">
                    <Border x:Name="border" Background="{TemplateBinding Background}"
						BorderBrush="{TemplateBinding BorderBrush}"
                        Visibility="Collapsed" CornerRadius="3"
						BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="Busy">
                                <VisualState x:Name="NotBusy" >
                                </VisualState>
                                <VisualState x:Name="IsBusy">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="border">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.200" Value="{x:Static Visibility.Visible}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(ProgressBar.IsIndeterminate)" Storyboard.TargetName="progressBar">
                                            <DiscreteBooleanKeyFrame KeyTime="0:0:0.200" Value="True"/>
                                        </BooleanAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel x:Name="content" Margin="3,2" IsHitTestVisible="False">
                            <TextBlock Text="{TemplateBinding BusyMessage}"/>
                            <ProgressBar Height="5" x:Name="progressBar" />
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>